package cn.edu.abtu.controller;

import cn.edu.abtu.entity.EduChapter;
import cn.edu.abtu.service.EduChapterService;
import cn.edu.abtu.vo.ResponseData;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;


@RestController
@CrossOrigin
@RequestMapping("/eduservice/chapter")
public class EduChapterController {

    @Autowired
    private EduChapterService eduChapterService;

    @PostMapping("/addChapter")
    public ResponseData addChapter(@RequestBody EduChapter eduChapter){
        return  eduChapterService.addChapter(eduChapter);
    }

    @DeleteMapping("/deleteChapterInfo/{chapterId}")
    public ResponseData deleteChapterInfo(@PathVariable String chapterId){
        return eduChapterService.deleteChapterInfo(chapterId);
    }

    //课程大纲列表,根据课程ID进行查询
    @GetMapping("/getChapterVideo/{courseId}")
    public ResponseData getChapterVideo(@PathVariable String courseId){
        return eduChapterService.getChapterVideo(courseId);
    }

    @GetMapping("/getChapterInfo/{chapterId}")
    public ResponseData getChapterInfo(@PathVariable String chapterId){
        return eduChapterService.getChapterInfo(chapterId);
    }

    @PostMapping("/updateChapter")
    public ResponseData updateChapter(@RequestBody EduChapter eduChapter){
        return  eduChapterService.updateChapter(eduChapter);
    }
}

